package com.nulldev.util.web.HttpServer3.testing;

import com.nulldev.util.JVM.JVM;
import com.nulldev.util.web.HttpServer3.HttpServer3;
import com.nulldev.util.web.HttpServer3.ReadRequest;
import com.nulldev.util.web.HttpServer3.SSLBehaviour;
import com.nulldev.util.web.HttpServer3.extensions.sse.SSEPage;
import com.nulldev.util.web.HttpServer3.extensions.sse.SSESession;

public class SSETests {

	public static void main(String[] args) throws Exception {
		final HttpServer3 hs3 = new HttpServer3(9091, true, SSLBehaviour.DISABLED, null);
		hs3.isTimingDebugEnabled = true;
		hs3.logger().debugEnabled.set(true);
		hs3.logger().traceEnabled.set(true);
		hs3.flags().enable_sse = true;
		hs3.addPage(new SSEPage("/") {

			@Override
			public void sessionDisconnected(SSESession sseSession) {
				JVM.println("Session disconnected: " + sseSession);
			}

			@Override
			public void sessionConnected(SSESession sseSession, ReadRequest rr, String url) {
				JVM.println("Session connected: " + sseSession);
			}
		});
	}

}
